/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */

package com.poltman.dscentral.db.repository.dspace;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.poltman.dscentral.db.entity.dspace.EPersonEntity;



/**
 * 
 * @author z.ciok@poltman.com
 * @version $Revision: 1808 $
 *
 */
@Transactional(readOnly = true)
public interface EpersonRepository extends JpaRepository<EPersonEntity, Integer> {
	
	public EPersonEntity findByEpersonId(Integer epersonId);
	public EPersonEntity findByEmail(String email);
	public EPersonEntity findByNetid(String netid);
	
	@SuppressWarnings("unchecked")
	@Modifying
	@Transactional
	public EPersonEntity save(EPersonEntity epersonEntity);
	
	@Modifying
	@Transactional
	@Query("update EPersonEntity e set e.canLogIn = ?1 where e.epersonId = ?2")
	public int setFixedCanLogInFor(Boolean canLogIn, Integer epersonId); 	
}
